﻿using DI;
using Core.Context;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StructureMap.Pipeline;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Library.Logging;
using Core.Domain;
using Core.Factories;
using Core.IServices;
using Repositories;
using Core.IRepository;

namespace Tests.Assembler
{
    [TestClass]
    public class BootstrapperTest
    {
        [TestInitialize()]
        public void Initialize()
        {
            Bootstrapper.Init(new SingletonLifecycle());
        }

        [TestCleanup()]
        public void Cleanup()
        {

        }

        [TestMethod]
        public void Bootstrapper_ILogger_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<ILogger>();

            //Assert
            Assert.IsNotNull(obj);
        }

        [TestMethod]
        public void Bootstrapper_IUserRepository_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<IUserRepository>();
            var list = obj.FindAll();

            //Assert
            Assert.IsNotNull(obj);
            Assert.IsNotNull(list);
        }

        [TestMethod]
        public void Bootstrapper_IManageRoleService_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<IManageRoleService>();

            //Assert
            Assert.IsNotNull(obj);
        }

        [TestMethod]
        public void Bootstrapper_IManageUserService_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<IManageUserService>();            

            //Assert
            Assert.IsNotNull(obj);            
        }

        [TestMethod]
        public void Bootstrapper_IUserStoreService_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<IUserStoreService>();            

            //Assert
            Assert.IsNotNull(obj);            
        }

        [TestMethod]
        public void Bootstrapper_AppIdentityDbContext_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<AppIdentityDbContext>();            

            //Assert
            Assert.IsNotNull(obj);            
        }
    }
}
